package main.od;

import java.util.Scanner;

public class FindMaxSeqLength {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String inputStr = scanner.nextLine();
        int max = 1;
        int length = 1;
        boolean flag = false;
        char[] strArr = inputStr.toCharArray();
        if (1 == strArr.length && strArr[0] >= '0' && strArr[0] <= '9'){
            System.out.println(1);
            return;
        }
        for (int i = 1;i < strArr.length;i++){
            if ((strArr[i-1] >= '0' && strArr[i-1] <= '9') || (strArr[i] >= '0' && strArr[i] <= '9')){
                flag = true;
            }
            if (strArr[i-1] <= strArr[i] && strArr[i] >= '0' && strArr[i] <= '9'){
                length++;
                if (max < length){
                    max = length;
                }
            }else {
                length = 1;
            }
        }
        if (flag){
            System.out.println(max);
        }else {
            System.out.println(0);
        }
    }
}
